package mllib

import org.apache.spark.sql.{DataFrame, SparkSession}
import org.apache.spark.{SparkConf, SparkContext}

/**
 * DESC:本地向量--mllib的LabeledPoint
 */
object _04libsvmSparkSQL {
  def main(args: Array[String]): Unit = {
    val conf: SparkConf = new SparkConf().setAppName("_04libsvmSparkSQL").setMaster("local[*]")
    val spark: SparkSession = SparkSession.builder().config(conf).getOrCreate()
    val sc: SparkContext = spark.sparkContext
    sc.setLogLevel("WARN")
    val path = "mldata/libsvmWine.txt"


    val data: DataFrame = spark.read.format("libsvm").load(path)
    data.printSchema()
    //    root
    //    |-- label: double (nullable = true)
    //    |-- features: vector (nullable = true)
    data.show(truncate = false)
    spark.stop()
  }
}
